package es

import (
	"everyone/C/rpc_C/appconfig"
	"fmt"
	"github.com/elastic/go-elasticsearch/v7"
)

var Es *elasticsearch.Client

func EsInit() {
	var err error
	cfg := elasticsearch.Config{
		Addresses: []string{
			appconfig.ViperData.Es.Addresses,
		},
		// ...
	}
	Es, err = elasticsearch.NewClient(cfg)
	if err != nil {
		panic(err)
	} else {
		fmt.Println("Es连接成功")
	}
}
